{extend name="../../admin/view/common/main"/}
{block name="style"}
<link href="__ADMIN_CSS__/main.min.css" type="text/css" rel="stylesheet">
<!--图片上传-->
<script type="text/javascript" charset="utf-8" src="__STATIC__/common/lib/webuploader/js/webuploader.js"></script>
<link href="__STATIC__/common/lib/webuploader/css/webuploader.css" type="text/css" rel="stylesheet">
{/block}

{block name="body"}
<ol class="breadcrumb">
	<i class="icon icon-angle-left"></i>
	<li>
		<a href="{:url('lists')}">文章管理</a>
	</li>
	<li>
		新增/编辑 文章
	</li>
</ol>


<div class="article-edit-section">
	<ul class="nav nav-primary tab-menu">
		<li class="active"><a data-tab href="#tabBase">基础设置</a></li>
		<li><a data-tab href="#tabContent">文章详情</a></li>
		<li><a data-tab href="#tabCustom">自定义设置</a></li>
	</ul>
	<form action="" method="post" class="form-horizontal form ajax-form card" role="form" id="form1">

		<input type="hidden" name="id" value="{$data['id']}">
		
		<div class="form-body">
			<div class="tab-content">
				<!--课程基本信息-->
				<div class="tab-pane active" id="tabBase">
					<div class="form-group">
						<label class="col-sm-2 control-label">文章标题</label>
						<div class="form-controls col-sm-8">
							<input type="text" class="form-control" name="title" placeholder="文章标题" value="{$data['title']}">
							<div class="help-block">请填写文章标题</div>
						</div>
					</div>
		
					<div class="form-group">
						<label class="col-sm-2 control-label">简短描述</label>
						<div class="form-controls col-sm-8">
							<textarea class="form-control" rows="3" name="description" placeholder="文章简短描述">{$data['description']}</textarea>
							<div class="help-block">请填写文章简短描述</div>
						</div>
					</div>
		
					<div class="form-group">
						<label class="col-sm-2 control-label">封 面 图</label>
						<div class="form-controls col-sm-8">
							{:single_image_upload('cover', $data['cover'])}
							<div class="help-block">封面建议尺寸：800*600px，支持jpg、png</div>
						</div>
					</div>
					
					<div class="form-group">
						<label class="col-sm-2 control-label">分 类</label>
						<div class="form-controls col-sm-8">
							{include file="admin/category/_category"/}
						</div>
					</div>
		
					<div class="form-group">
						<label class="col-sm-2 control-label">排序</label>
						<div class="form-controls col-sm-8">
							<input type="number" class="form-control" name="sort" value="{$data['sort']}" placeholder="排序" max="255">
							<div class="help-block">数字越大，越靠前，最大255。</div>
						</div>
					</div>

					<div class="form-group">
						
						<label class="col-sm-2 control-label">状态设置</label>
						<div class="fform-control-static col-sm-8 status-section">
							{if $data['status'] == 1}
							<input type="radio" name="status" id="is_status-1" value="1" checked> 
							<label class="radio-inline" for="is_status-1">启用</label>
							<input type="radio" name="status" id="is_status-0" value="0">
							<label class="radio-inline" for="is_status-0"> 禁用</label>
							<input type="radio" name="status" id="is_status--1" value="-1">
							<label class="radio-inline" for="is_status--1"> 未审核</label>
							<input type="radio" name="status" id="is_status--2" value="-2">
							<label class="radio-inline" for="is_status--2"> 审核未通过</label>
							{/if}
							{if $data['status'] == 0}
							<input type="radio" name="status" id="is_status-1" value="1"> 
							<label class="radio-inline" for="is_status-1">启用</label>
							<input type="radio" name="status" id="is_status-0" value="0" checked>
							<label class="radio-inline" for="is_status-0"> 禁用</label>
							<input type="radio" name="status" id="is_status--1" value="-1">
							<label class="radio-inline" for="is_status--1"> 未审核</label>
							<input type="radio" name="status" id="is_status--2" value="-2">
							<label class="radio-inline" for="is_status--2"> 审核未通过</label>
							{/if}
							{if $data['status'] == -1}
							<input type="radio" name="status" id="is_status-1" value="1"> 
							<label class="radio-inline" for="is_status-1">启用</label>
							<input type="radio" name="status" id="is_status-0" value="0" >
							<label class="radio-inline" for="is_status-0"> 禁用</label>
							<input type="radio" name="status" id="is_status--1" value="-1" checked>
							<label class="radio-inline" for="is_status--1"> 未审核</label>
							<input type="radio" name="status" id="is_status--2" value="-2">
							<label class="radio-inline" for="is_status--2"> 审核未通过</label>
							{/if}
							{if $data['status'] == -2}
							<input type="radio" name="status" id="is_status-1" value="1"> 
							<label class="radio-inline" for="is_status-1">启用</label>
							<input type="radio" name="status" id="is_status-0" value="0">
							<label class="radio-inline" for="is_status-0"> 禁用</label>
							<input type="radio" name="status" id="is_status--1" value="-1">
							<label class="radio-inline" for="is_status--1"> 未审核</label>
							<input type="radio" name="status" id="is_status--2" value="-2" checked>
							<label class="radio-inline" for="is_status--2"> 审核未通过</label>
							{/if}
						</div>
					</div>
					<div class="{if $data['status'] == -2}form-group{else}form-group hidden{/if}" id="statusReason">
						<label class="col-sm-2 control-label">未通过原因</label>
						<div class="form-controls col-sm-8">
							<textarea class="form-control" rows="3" name="reason" placeholder="请填写未通过审核原因">{$data['reason']}</textarea>
							<div class="help-block">请填写未通过审核原因</div>
						</div>
					</div>
					<script>
						$(function(){
							$(".status-section input[type='radio']").on("click",function () {
								if($("input[id='is_status--2']:checked").val()=="-2"){
									$('#statusReason').removeClass('hidden');
								}else{
									$('#statusReason').addClass('hidden');
								}
							})
						})
					</script>
				</div>

				<!--课程描述-->
				<div class="tab-pane" id="tabContent">
		
					<div class="form-group">
						<label class="col-sm-2 control-label">完整内容</label>
						<div class="form-controls col-sm-8" style="">
							{:ueditor('content', 'content', $data['content'])}
						</div>
					</div>
				</div>

				<!--自定义设置-->
				<div class="tab-pane" id="tabCustom">
					<div class="form-group">
						<label class="col-sm-2 control-label">自定义浏览量</label>
						<div class="form-controls col-sm-8">
							<input type="number" class="form-control" name="f_view" value="{$data['f_view']}" placeholder="浏览量">
							<div class="help-block">自定义浏览量</div>
						</div>
					</div>

					<div class="form-group">
						<label class="col-sm-2 control-label">自定义点赞量</label>
						<div class="form-controls col-sm-8">
							<input type="number" class="form-control" name="f_support" value="{$data['f_support']}" placeholder="点赞量">
							<div class="help-block">自定义点赞量</div>
						</div>
					</div>
		
					<div class="form-group">
						<label class="col-sm-2 control-label">自定义收藏量</label>
						<div class="form-controls col-sm-8">
							<input type="number" class="form-control" name="f_favorites" value="{$data['f_favorites']}" placeholder="收藏量">
							<div class="help-block">自定义收藏量</div>
						</div>
					</div>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-2 control-label"></label>
				<div class="form-controls col-sm-8">
					<button type="submit" class="btn btn-lg btn-primary">确认提交</button>
				</div>
			</div>
		</div>
	</form>
</div>
{/block}
{block name="script"}
<script src="__ADMIN_JS__/main.min.js"></script>
{/block}